From: Debian Science Maintainers Date: Tue, 28 Jan 2020 22:29:29 +0000 (+0000) Subject: Give a more useful error if cvxopt is not found X-Git-Tag: archive/raspbian/0.11.1-2+rpi1~2^2~13 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=44bf76a1df5cf2838b704b7f3704d900d460d884;p=statsmodels.git Give a more useful error if cvxopt is not found message wasn't actually passed to anything, so it previously failed at statsmodels/base/optimizer.py:13 (_check_method) with "Unknown fit method l1_cvxopt_cp" Author: Rebecca N. Palmer Forwarded: accepted https://github.com/statsmodels/statsmodels/pull/6163 Gbp-Pq: Name show_cvxopt_error.patch --- diff --git a/statsmodels/discrete/discrete_model.py b/statsmodels/discrete/discrete_model.py index 4b4675d..561c1a4 100644 --- a/statsmodels/discrete/discrete_model.py +++ b/statsmodels/discrete/discrete_model.py @@ -353,8 +353,8 @@ class DiscreteModel(base.LikelihoodModel): from statsmodels.base.l1_cvxopt import fit_l1_cvxopt_cp extra_fit_funcs['l1_cvxopt_cp'] = fit_l1_cvxopt_cp elif method.lower() == 'l1_cvxopt_cp': - message = ("Attempt to use l1_cvxopt_cp failed since cvxopt " - "could not be imported") + raise ValueError("Cannot use l1_cvxopt_cp as cvxopt " + "was not found (install it, or use method='l1' instead)") if callback is None: callback = self._check_perfect_pred